
<!-- Table 'elements' edit -->
<form action="?" method="post" enctype="multipart/form-data" name="frmEdit" class="form-horizontal">
<!-- TITLE (varchar) -->


<h3>Element details</h3>
[#if OK#]
<div class="alert alert-success">
<#LANG_DATA_SAVED#>
</div>
[#endif OK#]
[#if ERR#]
<div class="alert alert-error">
<#LANG_FILLOUT_REQURED#>
</div>
[#endif ERR#]
[#if ELEMENT_ID=""#]
<h4>
<#LANG_NEW_RECORD#>
</h4>
[#endif ELEMENT_ID#]


<div class="control-group">
        <label class="control-label"><#LANG_TITLE#> (*)</label>
        <div class="controls">
                <input type="text" name="title" value="[#ELEMENT_TITLE#]" required>
        </div>
</div>

<div class="control-group">
        <label class="control-label"><#LANG_SCENE#></label>
        <div class="controls">
                <select name="scene_id" required>
                        <option value="" disabled selected>select
                        [#begin SCENES#]
                        <option value="[#ID#]"[#if ID="<#ELEMENT_SCENE_ID#>"#] selected[#endif#]>[#TITLE#]
                        [#end SCENES#]
                </select>
        </div>
</div>


<!-- TYPE (select) -->

<div class="control-group">
        <label class="control-label"><#LANG_TYPE#></label>
        <div class="controls">
                <select name="type" required>
                        <option value="" disabled selected>select
                        <option value="img"[#if ELEMENT_TYPE=="img"#] selected[#endif#]><#LANG_IMAGE#>
                        <option value="html"[#if ELEMENT_TYPE=="html"#] selected[#endif#]>HTML
                </select>
        </div>
</div>

<!-- TOP (int) -->

<div class="control-group">
        <label class="control-label"><#LANG_TOP#></label>
        <div class="controls">
                <input type="text" name="top" value="[#ELEMENT_TOP#]">
        </div>
</div>


<!-- LEFT (int) -->

<div class="control-group">
        <label class="control-label"><#LANG_LEFT#></label>
        <div class="controls">
                <input type="text" name="left" value="[#ELEMENT_LEFT#]">
        </div>
</div>


[#if ELEMENT_TYPE="html"#]
<!-- WIDTH (int) -->

<div class="control-group">
        <label class="control-label"><#LANG_WIDTH#></label>
        <div class="controls">
                <input type="text" name="width" value="[#ELEMENT_WIDTH#]">
        </div>
</div>

<!-- HEIGHT (int) -->

<div class="control-group">
        <label class="control-label"><#LANG_HEIGHT#></label>
        <div class="controls">
                <input type="text" name="height" value="[#ELEMENT_HEIGHT#]">
        </div>
</div>

<div class="control-group">
        <label class="control-label"><#LANG_USE_BACKGROUND#></label>
        <div class="controls">
                <input type="radio" name="background" value="1"[#if ELEMENT_BACKGROUND=="1"#]checked[#endif#]> <#LANG_YES#>
                <br>
                <input type="radio" name="background" value="0"[#if ELEMENT_BACKGROUND!="1"#]checked[#endif#]> <#LANG_NO#>
        </div>
</div>

<div class="control-group">
        <label class="control-label"><#LANG_USE_JAVASCRIPT#></label>
        <div class="controls">
        <input type="checkbox" name="use_javascript" value="1"[#if ELEMENT_JAVASCRIPT!=""#] checked[#endif#] onClick='$("#element_javascript").toggle();'> <#LANG_YES#>
        <div id="element_javascript"[#if ELEMENT_JAVASCRIPT=""#] style="display:none"[#endif#]>
        <textarea name="javascript" rows="6" class="field span6">[#ELEMENT_JAVASCRIPT#]</textarea>
        </div>
        </div>
</div>

[#endif ELEMENT_TYPE#]
<!-- CROSS_SCENE (int) -->
<!--#
<tr>
 <td align=right>
  &nbsp;
 </td>
 <td>
  <input type="checkbox" name="cross_scene" value="1"[#if ELEMENT_CROSS_SCENE="1"#] checked[#endif#]> cross scene element
 </td>
</tr>
#-->

[#if ELEMENT_ID!=""#]

<h3><#LANG_STATES#></h3>
<ul>
[#begin STATES#]
<li><a href="?id=<#ID#>&view_mode=<#VIEW_MODE#>&tab=<#TAB#>&view_mode2=<#VIEW_MODE2#>&element_id=<#ELEMENT_ID#>&state_id=[#ID#]">[#if ID="<#STATE_ID#>"#]<b>[#endif#][#TITLE#][#if ID="<#STATE_ID#>"#]</b>[#endif#]</a></li>
[#end STATES#]
</ul>

[#if STATE_ID=""#]
<h4><#LANG_ADD_NEW_STATE#></h4>
[#else STATE_ID#]
<a class="btn btn-mini" href="?id=<#ID#>&view_mode=<#VIEW_MODE#>&tab=<#TAB#>&view_mode2=<#VIEW_MODE2#>&element_id=<#ELEMENT_ID#>&state_id=new"><i class="icon-plus-sign"></i> <#LANG_ADD_NEW_STATE#></a>
[#endif STATE_ID#]

<div class="control-group">
        <label class="control-label">State <#LANG_TITLE#></label>
        <div class="controls">
                <input type="text" name="state_title_new" value="[#STATE_TITLE#]">
        </div>
</div>

[#if STATE_ID!=""#]
<div class="control-group">
        <label class="control-label">&nbsp;</label>
        <div class="controls">
                <label class="checkbox"><input type="checkbox" name="state_delete" value="1"> <#LANG_DELETE#></label>
        </div>
</div>
[#endif#]


[#if "<#ELEMENT_TYPE#>"=="html"#]
<div class="control-group">
        <label class="control-label"><#LANG_CODE#></label>
        <div class="controls">
                <textarea name="html_new" rows="5" cols="41" class="field span6">[#STATE_HTML#]</textarea>
        </div>
</div>
[#endif#]

[#if "<#ELEMENT_TYPE#>"=="img"#]

<div class="control-group">
        <label class="control-label"><#LANG_IMAGE#></label>
        <div class="controls">
                <input type="text" name="image_new" id="image_new" value="[#STATE_IMAGE#]" onclick="openFileBrowser('image_new');" size="40">
                <p class="help-block">
                [#if STATE_IMAGE!=""#]
                <img src="[#STATE_IMAGE#]" border="0">
                [#endif#]
                </p>
        </div>
</div>

<script type="text/javascript">
     function openFileBrowser(id){
          fileBrowserlink = "/pdw/index.php?editor=standalone&returnID=" + id;
          window.open(fileBrowserlink,'pdwfilebrowser', 'width=1000,height=650,scrollbars=no,toolbar=no,location=no');
     }
</script>

[#endif#]

<div class="control-group">
        <label class="control-label"><#LANG_RUN_SCCRIPT_ON_CLICK#></label>
        <div class="controls">
                <select name="script_id_new">
                <option value="0">
                [#begin SCRIPTS#]
                <option value="[#ID#]"[#if ID="<#STATE_SCRIPT_ID#>"#] selected[#endif#]>[#TITLE#]
                [#end SCRIPTS#]
                </select>
        </div>
</div>

<div class="control-group">
        <label class="control-label"><#LANG_SHOW_MENU_ON_CLICK#></label>
        <div class="controls">
                <select name="menu_item_id_new">
                <option value="0">
                [#begin MENU_ITEMS#]
                <option value="[#ID#]"[#if ID="<#STATE_MENU_ITEM_ID#>"#] selected[#endif#]>[#TITLE#]
                [#end MENU_ITEMS#]
                </select>
        </div>
</div>


<div class="control-group">
        <label class="control-label"><#LANG_ONCHANGE_OBJECT#>.<#LANG_METHOD#></label>
        <div class="controls">
        <input type="text" name="action_object_new" value="[#STATE_ACTION_OBJECT#]"> .
        <input type="text" name="action_method_new" value="[#STATE_ACTION_METHOD#]">
        </div>
</div>


<div class="control-group">
        <label class="control-label"><#LANG_DISPLAY_CONDITION#></label>
        <div class="controls">
                <label class="radio"><input type="radio" name="is_dynamic_new" class="is_dynamic_new" value="0"[#if STATE_IS_DYNAMIC="0" || STATE_IS_DYNAMIC=""#] checked[#endif#]> n/a (<#LANG_ALWAYS_VISIBLE#>)</label>
                <label class="radio"><input type="radio" name="is_dynamic_new" class="is_dynamic_new" value="1"[#if STATE_IS_DYNAMIC="1"#] checked[#endif#]> <#LANG_SIMPLE#></label>
                <label class="radio"><input type="radio" name="is_dynamic_new" class="is_dynamic_new" value="2"[#if STATE_IS_DYNAMIC="2"#] checked[#endif#]> <#LANG_ADVANCED#></label>
        </div>
</div>

<script language="javascript">
 $('.is_dynamic_new').click (function ()
  {
  var thisCheck = $(this);
  if (thisCheck.val()==1) {
   $('#condition_block_new').show();
   $('#condition_advanced_block_new').hide();
   $('#switch_scene_block').show();
  } else if (thisCheck.val()==2) {
   $('#condition_block_new').hide();
   $('#condition_advanced_block_new').show();
   $('#switch_scene_block').show();
  } else {
   $('#condition_block_new').hide();
   $('#condition_advanced_block_new').hide();
   $('#switch_scene_block').hide();
  }
 }
 );
</script>
  <div id="condition_block_new"[#if STATE_IS_DYNAMIC!="1"#] style="display:none"[#endif#]>
   <div class="control-group">
        <label class="control-label">Object</label>
        <div class="controls">
                <input type="text" name="linked_object_new" size="10" value="[#STATE_LINKED_OBJECT#]">
        </div>
        </div>
     
        <div class="control-group">
        <label class="control-label">Property</label>
        <div class="controls">
                 <input type="text" name="linked_property_new" size="10" value="[#STATE_LINKED_PROPERTY#]">
        </div>
        </div>
        
    <div class="control-group">
        <label class="control-label">Condition</label>
        <div class="controls">
         <select name="condition_new">
      <option value="1"[#if STATE_CONDITION="1"#] selected[#endif#]>=
      <option value="2"[#if STATE_CONDITION="2"#] selected[#endif#]>&gt;
      <option value="3"[#if STATE_CONDITION="3"#] selected[#endif#]>&lt;
      <option value="4"[#if STATE_CONDITION="4"#] selected[#endif#]>&lt;&gt;
     </select>
        </div>
        </div>

    <div class="control-group">
        <label class="control-label">Value</label>
        <div class="controls">
                 <input type="text" name="condition_value_new" size="10" value="[#STATE_CONDITION_VALUE#]">
        </div>
        </div>
  
   
  </div>
  <div id="condition_advanced_block_new"[#if STATE_IS_DYNAMIC!="2"#] style="display:none"[#endif#]>
   <div class="control-group">
        <label class="control-label">Advanced condition</label>
        <div class="controls">
                <textarea name="condition_advanced_new" rows="5" cols="40">[#STATE_CONDITION_ADVANCED#]</textarea>
                <p class="help-block">
                <p><i><#LANG_EXAMPLE#>:</i></p>
<pre>if ($a>$b) {
        $display=1;
} else {
        $display=0;
}</pre>
                </p>
                </div>
        </div>
  </div>
  <div id="switch_scene_block" [#if STATE_IS_DYNAMIC="0"#] style="display:none"[#endif#]>
    <div class="control-group">
        <label class="control-label">&nbsp;</label>
        <div class="controls">
                <label class="checkbox"><input type="checkbox" name="switch_scene_new" value="1"[#if STATE_SWITCH_SCENE="1"#] checked[#endif#]> <#LANG_SWITCH_SCENE_WHEN_ACTIVATED#></label>
        </div>
        </div>
  </div>

<input type="hidden" name="state_id" value="[#STATE_ID#]">
</div>
[#endif ID#]



<div class="form-actions">
 [#if ID!=""#]
 <button class="btn" type="submit" name="subm"><i class="icon-ok"></i> <#LANG_SUBMIT#></button>
 [#else ID#]
 <button class="btn" type="submit" name="subm"><i class="icon-plus-sign"></i> <#LANG_ADD#></button>
 [#endif ID#]

 <a class="btn" href="?tab=elements&id=<#ID#>&view_mode=edit_scenes"><#LANG_CANCEL#></a>

 [#if ID!=""#]
 <a class="btn" href="?tab=elements&id=<#ID#>&view_mode=<#VIEW_MODE#>&edit_mode=<#EDIT_MODE#>&view_mode2=clone_elements&element_id=<#ELEMENT_ID#>" onClick="return confirm('<#LANG_ARE_YOU_SURE#>')"><#LANG_MAKE_COPY#></a>
 [#endif ID#]

</div>
 
<input type="hidden" name="element_id" value="<#ELEMENT_ID#>">
<input type="hidden" name="id" value="<#ID#>">
<input type="hidden" name="view_mode" value="<#VIEW_MODE#>">
<input type="hidden" name="edit_mode" value="<#EDIT_MODE#>">
<input type="hidden" name="view_mode2" value="edit_elements">
<input type="hidden" name="mode" value="update">
<input type="hidden" name="tab" value="<#TAB#>">
<input type="hidden" name="data_source" value="<#DATA_SOURCE#>">

</form>